package chai.ning.cs.buffer;

/*
 * 	1、了解StringBuffer
 * 	2、capacity 容量  / length 长度 /append  在后面附加 /indexOf /delete 删除
 * 	3、int index = buffer.indexOf(".55.");字符串中的值紧跟双引号，切记，不能留空格，否则，无变化
 */
public class StringBufferTest1 {

	public static void main(String[] args) {
		StringBuffer buffer = new StringBuffer();
		System.out.println("capacity : " + buffer.capacity() + ",length : " + buffer.length());
		buffer.append(true);
		buffer.append(false);
		buffer.append(2.5F);
		System.out.println("capacity : " + buffer.capacity() + ",length : " + buffer.length());
		buffer.append(5.32);
		buffer.append(6);
		System.out.println("capacity : " + buffer.capacity() + ",length : " + buffer.length());
		System.out.println(buffer);
		int index = buffer.indexOf(".55.");
		if (index >= 0) {
			buffer.delete(index, index + 4);
		}
		System.out.println(buffer);
		System.out.println("capacity : " + buffer.capacity() + ",length : " + buffer.length());
		Class<?> c = buffer.getClass();
		System.out.println( c.getName() );
		
		Class<?> p = c.getSuperclass();
		System.out.println( p.getName() );
	}
}
